package com.firesrc.service.server;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import com.firesrc.bean.ProcessorBean;

public class ProcessDataServiceImpl implements ProcessDataService {

  @Override
  public String handle(final ProcessorBean processorBean) {
    ExecutorService executor = Executors.newSingleThreadExecutor();
    Callable<String> processTask = new ProcessDataCallable(processorBean);
    Future<String> task = executor.submit(processTask);
    try {
      return task.get();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return "";
  }
}
